package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbAccbb;
import com.ruoyi.tjbb.service.ISysTjbbAccbbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * acc报表Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/xsfx/accbb")
public class SysTjbbAccbbController extends BaseController
{
    @Autowired
    private ISysTjbbAccbbService sysTjbbAccbbService;

    /**
     * 查询acc报表列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:accbb:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbAccbb sysTjbbAccbb)
    {
        startPage();
        List<SysTjbbAccbb> list = sysTjbbAccbbService.selectSysTjbbAccbbList(sysTjbbAccbb);
        return getDataTable(list);
    }

    /**
     * 导出acc报表列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:accbb:export')")
    @Log(title = "acc报表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbAccbb sysTjbbAccbb)
    {
        List<SysTjbbAccbb> list = sysTjbbAccbbService.selectSysTjbbAccbbList(sysTjbbAccbb);
        ExcelUtil<SysTjbbAccbb> util = new ExcelUtil<SysTjbbAccbb>(SysTjbbAccbb.class);
        util.exportExcel(response, list, "acc报表数据");
    }

    /**
     * 获取acc报表详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:accbb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysTjbbAccbbService.selectSysTjbbAccbbById(id));
    }

    /**
     * 新增acc报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:accbb:add')")
    @Log(title = "acc报表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbAccbb sysTjbbAccbb)
    {
        return toAjax(sysTjbbAccbbService.insertSysTjbbAccbb(sysTjbbAccbb));
    }

    /**
     * 修改acc报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:accbb:edit')")
    @Log(title = "acc报表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbAccbb sysTjbbAccbb)
    {
        return toAjax(sysTjbbAccbbService.updateSysTjbbAccbb(sysTjbbAccbb));
    }

    /**
     * 删除acc报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:accbb:remove')")
    @Log(title = "acc报表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysTjbbAccbbService.deleteSysTjbbAccbbByIds(ids));
    }
}
